package main.controllers;

import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.builder.LayerBuilder;
import de.lessvoid.nifty.builder.PanelBuilder;
import de.lessvoid.nifty.controls.button.builder.ButtonBuilder;
import de.lessvoid.nifty.controls.label.builder.LabelBuilder;
import de.lessvoid.nifty.controls.window.builder.WindowBuilder;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;

public class MainScreenController implements ScreenController{
	private Nifty nifty;
	private Screen screen;
	  
	public MainScreenController()
	{
		System.out.println("MainScreenController construct.");
	}
	  
	@Override
	public void bind(Nifty n, Screen s) {
		this.nifty = n;
		this.screen = s;	
	
		 final String windowId = "start";
         
//         new LayerBuilder("_infoWindowLayer"){{
//                 childLayoutAbsolute();
//                 width("100%");
//                 height("100%");
//                 control(new WindowBuilder(windowId, "Basic 1.0") {{
//                         visibleToMouse(true);
//                         closeable(false);
//                         width("50%"); // windows will need a size
//                         height("150px");
//                         x("25%");
//                         y("35%");
//                         panel(new PanelBuilder("_rootPanel") {{
//                                 height("100%");
//                                 width("100%");
//                                 alignCenter();
//                                 childLayoutVertical();
//                                 color("#00000000");
//                                 control(new LabelBuilder("_infoText") {{
//                                         text("TEST");
//                                         style("base-font");
//                                         color("#eeef");
//                                         valignCenter();
//                                         width("100%");
//                                         height("75%");
//                                 }});
//                                 control(new ButtonBuilder("_btnOk") {{
//                                         name("button");
//                                         label("OK");
//                                         alignCenter();
//                                         width("50%");
//                                         height("25%");
//                                 }});
//                         }});
//                 }});
//         }}.build(nifty, screen, screen.getRootElement());
         
		 new PanelBuilder("_rootPanel") {{
             height("30px");
             width("30px");
             alignCenter();
             childLayoutVertical();
             color("#00000000");
             control(new LabelBuilder("infoText") {{
                     text("TEST");
                     style("base-font");
                     color("#eeef");
                     valignCenter();
                     width("100%");
                     height("75%");
             }});
		 }}.build(nifty, screen, screen.getRootElement());
          
         screen.layoutLayers();
		
//		control(new LabelBuilder("keyEventLabelId", "Text test !"));
	}
	

	@Override
	public void onEndScreen() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onStartScreen() {
	    System.out.println(this.screen.debugOutput());
	}

}
